﻿<%@ Page Title="Editace stránky" Language="C#" MasterPageFile="~/Pages/Site.Master" AutoEventWireup="true" CodeBehind="PageEdit.aspx.cs" Inherits="Altairis.FluffyCloud.WebCore.Pages.Sewen.PageEdit" %>
<asp:Content ContentPlaceHolderID="Main" runat="server">
    <div id="pagebox">
        <asp:FormView ID="PageFormView" runat="server" DataSourceID="PageObjectDataSource" RenderOuterTable="false" DefaultMode="Edit" OnItemCommand="PageFormView_ItemCommand" OnItemUpdated="PageFormView_ItemUpdated">
            <EmptyDataTemplate>
                <h1 id="title">Stránka neexistuje</h1>
                <p>Taková stránka neexistuje.</p>
                <altairis:IconHyperLink runat="server" Icon="PageAdd" NavigateUrl="<%$ RouteUrl: RouteName=WikiPageNew %>" Text="Vytvořit novou stránku" />
            </EmptyDataTemplate>
            <EditItemTemplate>
                <h1 id="title">
                    <asp:Literal runat="server" Text="Editace stránky" />
                    <asp:Literal ID="LiteralTitle" runat="server" Text='<%# Bind("Title") %>' />
                </h1>
                <p class="small r">
                    <asp:Literal runat="server" Text='<%# Eval("Version", "Verze: {0:d} {0:T}") %>' />
                    <asp:Literal runat="server" Text='<%# Eval("UserName", "| Uživatel: {0}") %>' />
                    <asp:Literal runat="server" Text='<%# Eval("IpAddress", "| IP: {0}") %>' />
                </p>
                <div class="form">
                    <p>
                        <asp:Label runat="server" Text="Text stránky:" AssociatedControlID="BodyTextBoxHtml" />
                        <asp:RequiredFieldValidator runat="server" ControlToValidate="BodyTextBoxHtml" ErrorMessage="Není zadán text stránky" Display="Dynamic" Text="*" />
                        <br />
                        <asp:TextBox ID="BodyTextBoxHtml" runat="server" Text='<%# Bind("Body") %>' TextMode="MultiLine" Height="300px" data-exteditortype="wikimarkup" />
                    </p>
                    <p>
                        <asp:Label runat="server" Text="Comment:" AssociatedControlID="CommentTextBox" />
                        <br />
                        <asp:TextBox ID="CommentTextBox" runat="server" Text='<%# Bind("Comment") %>' />
                    </p>
                    <asp:ValidationSummary runat="server" />
                    <p class="buttons">
                        <asp:Button runat="server" CausesValidation="True" CommandName="Update" Text="Odeslat" />
                        <asp:Button runat="server" CausesValidation="False" CommandName="Cancel" Text="Storno" />
                    </p>
                </div>
            </EditItemTemplate>
        </asp:FormView>
        <asp:ObjectDataSource ID="PageObjectDataSource" runat="server" TypeName="Altairis.Sewen.PageStoreManager" DataObjectTypeName="Altairis.Sewen.SewenPage" SelectMethod="LoadPage" UpdateMethod="SavePage">
            <SelectParameters>
                <asp:RouteParameter Name="name" RouteKey="slug" Type="String" DefaultValue="HomePage" />
            </SelectParameters>
        </asp:ObjectDataSource>
    </div>
</asp:Content>